package com.lswsjw.android.lib.sqlite;

import java.io.IOException;

/**
 * @author limtaekyu Making DB From File which located in assets folder
 */
public class DBOpenFromFile extends DBOpen
{
	private DBOpenHelper dbOpenHelper;
    
    /**
     * Making DB From File which located in assets folder
     */
    public DBOpenFromFile()
    {
        
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see com.lswsjw.android.lib.sqlite.DBOpenAdapter#getDBOpen()
     */
    
    public DBOpenHelper getDBOpen()
    {
    	if(dbOpenHelper == null)
    	{
    		dbOpenHelper = new DBOpenHelper(mContext, mName, mFactory, mVersion, mPackageName) {
        		
        		@Override
        		public void createDataBase() {
        			// TODO Auto-generated method stub
        			try
                    {
//                        super.getWritableDatabase();
                        super.copyDataBase();
                    }
                    catch (IOException ioe)
                    {
                    	ioe.printStackTrace();
                    }
                    catch (NullPointerException npe)
                    {
                    	npe.printStackTrace();
                    }
        		}
        	};
    	}
        return dbOpenHelper;
    }    
}
